package com.yang.springcloud;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

/**
 * 启动类
 *
 * @author shiwen
 * @date 2020/10/12
 */
@SpringBootApplication
@EnableEurekaClient // 这里就相当于将服务启动后自动注册到 localhost:7001 的eureka中
@EnableDiscoveryClient  // 服务发现
public class DeptProvider_8001 {

    public static void main(String[] args) {
        SpringApplication.run(DeptProvider_8001.class, args);
    }

    // 增加一个 servlet 的bean对象, 为了配合监控用的写死的代码
    //public ServletRegistrationBean hystrixMetricsStreamServlet() {
    //    ServletRegistrationBean registrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
    //    registrationBean.addUrlMappings("/actuator/hystrix.stream");
    //    return registrationBean;
    //}

}